$(function () {
    var eid = GetQueryString("eid");

    var sel = $.Params.create();
    sel.ajax("get", getMeetIP() + "meetSubject/" + eid, function (data) {
            var val = data;
            getBuild();
            $("#buildTitle").val(val.buildId);
            $("#subjectTitle").val(val.subjectTitle);
            $("#startTime").val(val.startTime);
            $("#endTime").val(val.endTime);
            $("#meetTime").val(val.meetTime);
            $("#meetDate").val(val.meetDate);
            $("#dbUrl").val(val.dbUrl);
    })

    $("#addData").on("click", function () {
        var buildId = $("#buildTitle").val();
        var subjectTitle = $("#subjectTitle").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var meetTime = $("#meetTime").val();
        var meetDate = $("#meetDate").val();
        var dbUrl = $("#dbUrl").val();
        var addSel = $.Params.create();
        addSel.addParams("buildId", buildId);
        addSel.addParams("subjectTitle", subjectTitle);
        addSel.addParams("startTime", startTime);
        addSel.addParams("endTime", endTime);
        addSel.addParams("meetTime", meetTime);
        addSel.addParams("meetDate", meetDate);
        addSel.addParams("dbUrl", dbUrl);
        addSel.ajax("put", getMeetIP() + "meetSubject/"+eid, function (data) {
               window.location.href = "meetSubjectList.html";
        })
    })
    function getBuild(){
        var meetSel = $.Params.create();
        meetSel.ajax("get", getMeetIP() + "build", function (data) {
            var html = "<option value='0'>请选择会议厅</option>";
            if(data.count > 0){
                $.each(data.rows,function(i,val){
                    html+="<option value = '"+val.id+"'>"+val.buildTitle+"</option>";
                })
            }
           $("#buildTitle").html(html);
        })
    
    }
})